<?php

/**
 * Shop filter form base class.
 *
 * @package    explications_informatiques
 * @subpackage filter
 * @author     Guimezanes Cyrille
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseShopFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nom'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'description' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prix'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'img'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'online'      => new sfWidgetFormChoice(array('choices' => array('' => '', 0 => '0', 1 => '1'))),
    ));

    $this->setValidators(array(
      'nom'         => new sfValidatorPass(array('required' => false)),
      'description' => new sfValidatorPass(array('required' => false)),
      'prix'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'img'         => new sfValidatorPass(array('required' => false)),
      'online'      => new sfValidatorChoice(array('required' => false, 'choices' => array(0 => '0', 1 => '1'))),
    ));

    $this->widgetSchema->setNameFormat('shop_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Shop';
  }

  public function getFields()
  {
    return array(
      'id'          => 'Number',
      'nom'         => 'Text',
      'description' => 'Text',
      'prix'        => 'Number',
      'img'         => 'Text',
      'online'      => 'Enum',
    );
  }
}
